<?php

namespace app\admin\model\dymz;

use think\Model;


class Fileupload extends Model
{

    

    

    // 表名
    protected $name = 'dymz_fileupload';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'type_text',
        'upload_status_text'
    ];
    

    
    public function getTypeList()
    {
        return ['1' => __('Type 1'), '2' => __('Type 2')];
    }

    public function getUploadStatusList()
    {
        return ['ING' => __('Upload_status ing'), 'SUCCESS' => __('Upload_status success'), 'FAIL' => __('Upload_status fail')];
    }


    public function getTypeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['type']) ? $data['type'] : '');
        $list = $this->getTypeList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getUploadStatusTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['upload_status']) ? $data['upload_status'] : '');
        $list = $this->getUploadStatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }




}
